﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using OpenChart.Entities;

namespace OpenChart.DrawChart
{
    /// <summary>
    /// 用来根据ChartType生产AbsDrawingChart类子类的实例的简单工厂
    /// </summary>
    class DrawingChartFactory
    {
        /// <summary>
        /// 产生一个用户绘制图表的对象
        /// </summary>
        /// <param name="type">图表类型</param>
        /// <returns>绘制图表的对象</returns>
        internal static AbsDrawingChart Create(Enums.ChartType type)
        {
            switch (type)
            {
                case Enums.ChartType.Line:
                    return new DrawingLineChart();
                case Enums.ChartType.Area:
                    return new DrawingAreaChart();
                case Enums.ChartType.LogarithmLine:
                    return new DrawingLogarithmLineChart();
                case Enums.ChartType.LogarithmArea:
                    return new DrawingLogarithmAreaChart();
                case Enums.ChartType.Dot:
                    return new DrawingDotChart();
                case Enums.ChartType.LogarithmDot:
                    return new DrawingLogarithmDotChart();
                case Enums.ChartType.Pie:
                    return new DrawingPieChart();
                default:
                    return null;
            }
        }
    }
}
